//
//  UIBarButtonItem+Extention.swift
//  WSWeibo
//
//  Created by guojianfeng on 2017/7/14.
//  Copyright © 2017年 guojianfeng. All rights reserved.
//

import Foundation

extension UIBarButtonItem{
    convenience init(title: String, fonSize: CGFloat = 16, target: AnyObject?, action: Selector, isBack: Bool = false){
        let btn: UIButton = UIButton.yw_textButton(title, fontSize: fonSize, normalColor: UIColor.darkGray, highlightedColor: UIColor.orange)
        if isBack {
            let imageName = "navigationbar_back_withtext"
            btn.setImage(UIImage(named: imageName), for: .normal)
            btn.setImage(UIImage(named: imageName + "_highlighted"), for: .highlighted)
            btn.sizeToFit()
        }
        btn.addTarget(target, action: action, for: .touchUpInside)
        self.init(customView: btn)
    }
}
